define(["jquery", "easy-admin", "xm-select"], function ($, ea) {
    let laydate = layui.laydate
        , form = layui.form;
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'machine.cate/index',
        add_url: 'machine.cate/add',
        edit_url: 'machine.cate/edit',
        delete_url: 'machine.cate/delete',
        export_url: 'machine.cate/export',
        modify_url: 'machine.cate/modify',
        partner_url: 'machine.cate/partner',
        withdrawal_url: 'machine.cate/withdrawal',
    };

    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [{
                        text: '添加',
                        url: init.add_url,
                        method: 'open',
                        auth: 'add',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus ',
                        extend: 'data-full="true"',
                    }],
                    'delete', 'export'],
                minWidth: 90,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '分组id'},
                    {field: 'title', title: '代理商名称', width: 100},
                    {field: 'mobile', title: '电话', width: 120},
                    {field: 'card_z', title: '身份证正面', templet: ea.table.image, width: 100, search: false},
                    {field: 'card_f', title: '身份证反面', templet: ea.table.image, width: 100, search: false},
                    {field: 'bank_name', title: '银行名称', width: 160},
                    {field: 'bank_number', title: '银行卡号', width: 160},
                    {field: 'logo', title: '营业执照', templet: ea.table.image, width: 120, search: false},
                    {field: 'commission', title: '佣金', templet: ea.table.price, width: 180, search: false},
                    {
                        field: 'status',
                        search: 'select',
                        selectList: ["禁用", "启用"],
                        title: '状态',
                        templet: ea.table.switch,
                        width: 180
                    },
                    {field: 'create_time', title: '创建时间', width: 160, search: 'range'},
                    {
                        width: 250, title: '操作', templet: ea.table.tool, operat: [
                            [{
                                text: '编辑',
                                extra: 'name',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-full="true"',
                            }, {
                                text: '分佣设置',
                                extra: 'name',
                                url: init.partner_url,
                                method: 'open',
                                auth: 'partner',
                                class: 'layui-btn layui-btn-xs layui-bg-blue',
                                extend: 'data-full="false"',
                            }, {
                                text: '提现',
                                extra: 'name',
                                url: init.withdrawal_url,
                                method: 'open',
                                auth: 'withdrawal',
                                class: 'layui-btn layui-btn-xs layui-bg-cyan',
                                extend: 'data-full="false"',
                            }],
                            'delete']
                    },
                ]],
            });

            ea.listen();
        },
        add: function () {


            ea.listen();
        },
        edit: function () {

            ea.listen();
        },
        partner: function () {

            ea.listen();
        },
        withdrawal: function () {

            ea.listen();
        },

    };
    return Controller;
});